package com.yx.cloud.product.laser.yxcloud;

import android.graphics.Bitmap;
import com.iot.product.sweeper.bean.Path;

public class YxCloudLaserPath extends Path {
    //LF独有
    public String oldPathData = null;
    private Bitmap bitmap;

    public Bitmap getBitmap() {
        return bitmap;
    }

    public synchronized void setBitmap(Bitmap newBitmap) {
        if (bitmap != null && !bitmap.isRecycled()) {
            bitmap.recycle();
        }
        this.bitmap = newBitmap;
    }

    public synchronized Bitmap copyBitmap() {
        if (bitmap == null || bitmap.isRecycled()) {
            return null;
        }
        return bitmap.copy(Bitmap.Config.ARGB_8888, true);
    }


    public void clear() {
        if (bitmap != null && !bitmap.isRecycled()) {
            bitmap.recycle();
            bitmap = null;
        }
        super.clear();
    }


    @Override
    public Object clone() {
        YxCloudLaserPath copyPath = (YxCloudLaserPath) super.clone();
        return copyPath;
    }

    @Override
    public String toString() {
        return "LFPath{" +
                "oldPathData='" + oldPathData + '\'' +
                ", bitmap=" + bitmap +
                ", pathID=" + pathID +
                ", mapID=" + mapID +
                ", destPathPoints=" + destPathPoints +
                '}';
    }
}
